import { queryOptions } from '@tanstack/vue-query';
import { request } from '@/http/request/alova'

export interface userInfoRes {
  id: number
  avatar: string
  nickname: string
  mobile: number
  skills: string
  remark: string
}

export function getUserInfo(): Promise<userInfoRes> {
  return request.Get(`/worker/user/get`)
}
export function updateUserInfo(data: any) {
  return request.Put(`/worker/user/update`, data, { meta: { original: true } })
}
export function updateWorkerAvatar(data: {avatar: string}) {
  return request.Post(`/worker/user/updateWorkerAvatar`, data)
}

export interface QualificationOptionType  {
  qualificationType: number,
  qualificationName: string,
  required: boolean,
  allowedExtensions: string,
  maxFileSize: number,
  maxFileCount: number,
  description: string
}
export function getUploadQualificationOptions() : Promise<QualificationOptionType[]> {
  return request.Get(`/partner/worker/qualification/getUploadQualification`)
}

export interface QualificationFileType {
  id: number,
  qualificationId: number,
  qualificationName: string,
  qualificationPath: string,
  fileType: string,
}
export interface QualificationListItemType  {
  id: number,
  createTime: number,
  qualificationType: number,
  qualificationName: string,
  reviewRemark: string,
  reviewStatus: number,
  reviewTime: number,
  qualificationFileRespVoList: QualificationFileType[],
}
export function getUploadQualificationList() : Promise<QualificationListItemType[]> {
  return request.Get(`/partner/worker/qualification/list`)
}
export function saveQualification(data: any) {
  return request.Post(`/partner/worker/qualification/save`, data, { meta: { original: true }})
}
export function deleteQualification(params: {id: number}) {
  return request.Get(`/partner/worker/qualification/deleteFile`,{ params, meta:{original: true} })
}
export interface ReviewItemType {
  bizId: number,
  bizType: number,
  evaluatedUser: number,
  evaluator: number,
  evaluatorName: string,
  evaluatorAvatar: string,
  rate: number,
  content: string,
  createTime: number
}
export interface ReviewDataType {
  total: number,
  list: ReviewItemType[]
}
export function getListSelfRated(params: {pageNo: number, pageSize: number}): Promise<ReviewDataType> {
  return request.Get(`/review/listSelfRated`,{ params })
}
export function updatePassword(data: {oldPassword: string, password: string}) {
  return request.Put(`/worker/user/update-password`, data, { meta: { original: true } })
}
// export function getWorkbenchPerformance() {
//   return request.Get(`/worker/repair/workbench/performance`)
// }
// export const login = (data: any) => {
//   return request.Post('/worker/auth/login', data)
// }
